<?php
require_once 'vendor/autoload.php'; //we load composer just for a better template system
include_once __DIR__ . "/config/phpinit.php";
if (DEBUG) {
    //we load a better Error handler ( bypass xdebug )
    $whoops = new Whoops\Run();
    $errorPage = new Whoops\Handler\PrettyPageHandler();

    $errorPage->setPageTitle("It's broken :'(");

    $whoops->pushHandler($errorPage);
    $whoops->register();
}

header('Content-type: text/html; charset=utf-8'); //set header charset
session_start();

define("ROOT", __DIR__); //define root directory for all php file

include_once __DIR__ . "/config/constant.php";
include_once __DIR__ . '/utils/Router.php';
include_once __DIR__ . '/config/database.php';
include_once __DIR__ . "/config/phpinit.php";
include_once __DIR__ . "/utils/Encoder.php";
//we set and load router to have rewriting and easy access to page
include_once __DIR__ . "/config/routing.php";
//we laod our personnal extension for our template engine
include_once __DIR__ . '/platesextension/RoutePlates.php';
include_once __DIR__ . '/platesextension/Asset.php';
//We load the template engine with our extension
$engine = new \League\Plates\Engine(__DIR__ . "/vue");
$engine->setFileExtension(null);
$engine->loadExtension(new RoutePlate());
$engine->loadExtension(new Asset(ROOT . '/assets'));
$template = new \League\Plates\Template($engine);


//var_dump($roleDao->findAll());
include_once $router->getController();







